<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 陪你度过漫长岁月
  Date: 2022/10/7
  Time: 13:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<div id="box">
    <h1>个人简历信息列表</h1>
    <form action="SelectServlet" >
        <div class="sex1">
            性别
            <input type="radio" name="sex" value="男" id="mefa">
            <label>男</label>

            <input type="radio" name="sex" value="女" id="famefa">
            <label>女</label>

            <input type="radio" name="sex" value="全部" id="quanbu" checked>
            <label>全部</label>

            <input type="submit" id="seletct"  value="查询" >

            <input type="button" id="btn" onclick="inser()" value="新增个人简历信息">
        </div>
    </form>
    <div class="table">
        <table border="1" cellspacing="1" cellpadding="1">
            <tr>
                <th>姓名</th>
                <th>性别</th>
                <th>籍贯地址</th>
                <th>出生时间</th>
                <th>联系电话</th>
                <th>毕业学校</th>
                <th>简历状态</th>
                <th>操作</th>
            </tr>

            <c:forEach var="list" items="${sessionScope.resume}">
                <tr>
                    <td>${list.userName}</td>
                    <td>${list.sex}</td>
                    <td>${list.address}</td>
                    <td>${list.birth}</td>
                    <td>${list.telephone}</td>
                    <td>${list.school}</td>
                    <c:if test="${list.status==0}">
                        <td>保密</td>
                    </c:if>
                    <c:if test="${list.status==1}">
                        <td>公开</td>
                    </c:if>
                    <td><a href="#" onclick="Delete(${list.id})">删除</a></td>
                </tr>
            </c:forEach>
        </table>
    </div>
</div>
<script>
    function inser(){
        document.location="add.jsp";
    }
    function Delete(id){
        var temp = confirm("确定要删除吗？")
        if(temp==true){
            $.getJSON("DeleteServlet",{'id':id},function (data){
                if(data.rows="1"){
                    alert("删除成功")
                    location.href="index.jsp"
                }else {
                    alert("删除失败")
                }
            })
        }
    }
</script>
</html>
